﻿@using CP_SchoolForChildren_v0._1.Models.DataModel
@model CP_SchoolForChildren_v0._1.Models.RelatedModel.EditProfileModel


@{
    ViewBag.Title = "Đổi thông tin cá nhân";
    Layout = "~/Views/Shared/FE/_Layout_FE_Index.cshtml";
    @ViewBag.Message
    var listSchool = ViewBag.ListSchool;
    SFCEntities db = new SFCEntities();
}
<script src="@Url.Content("~/Scripts/FE/jquery.validate.min.js")" type="text/javascript"> </script>
<script src="@Url.Content("~/Scripts/FE/jquery.validate.unobtrusive.min.js")" type="text/javascript"> </script>
<script type="text/javascript">
    $(function () {
        $("#DOB").datepicker({
            changeMonth: true,
            changeYear: true,
            minDate: "-100YYYY",
            maxDate: "+0D",
            yearRange: 'c-100,c+00'
        });
    });
</script>
<style type="text/css">
    #list-fav {
        padding: 10px;
        line-height: 25px;
    }
    #list-fav a {
        font-weight: normal;
    }
    #list-fav a:hover {
        font-weight: bold;
    }
    .control {
        *line-height: 25px;
        float: right;
        padding-right: 15px;
    }

    .control p {
        *height: 10px;
        padding: 5px;
        cursor: pointer;
    }

    .control p:hover { background-color: #F1D4AF; }
    .is-active {
        background-color: #F1D4AF;
    }
    #registertable td {
        vertical-align: top;
        word-wrap: break-word;
    }

    .field-validation-error {
        word-wrap: break-word;
        font-size: 10px;
        float: left;
        padding: 10px;
        padding-top: 0px;
    }

    #SelectGender {
        border: 3px solid #EBE6E2;
        border-radius: 5px 5px 5px 5px;
        display: block;
        float: left;
        font-size: 13px;
        font-weight: 400;
        margin-bottom: 5px;
        margin-left: 5px;
        padding: 5px;
        transition: all 0.3s ease-out 0s;
        width: 150px;
    }
</style>
<link href="@Url.Content("~/Content/FE/Addition.css")" rel="stylesheet" type="text/css" />
<div class="allhome" style="padding-top: 15px;">

    <div class="content-main" style="width: 100%">
        <div class="boxMod" id="edit1" >
            <div class="content-header">
                <div style="padding-left: 15px; padding-right: 15px;float: left">
                    <a>
                        <strong style="float: left; padding-bottom: 5px; font-size: 20px; color: #E08E79;">@Model.UserName</strong>
                        <br>
                        @if (string.IsNullOrEmpty(Model.AvatarURL))
                        {
                            Model.AvatarURL = @Url.Content("~/AvartarUser/default_avt.jpg");
                        }
                        <img src="@Model.AvatarURL" id="ProfileImage">
                    </a>
                </div>
                <br class="spacer"/>
            </div>
        </div>

        <div class="boxMod" id="edit1" >
            <div class="content-header">
                <div class="tweet-user" style="border-bottom: 1px solid #E8E8E8; margin-bottom: 10px;">
                    <h2 style="color: #774F38;">Thông tin cá nhân</h2>
                </div>
                @using (Html.BeginForm())
                {
                    @Html.ValidationSummary(true)
                    <div class="" style="float: left; padding-left: 10px; line-height: 25px">
                        <table id="registertable">
                            <tr>
                                <td style="text-align: right;">Họ và tên</td>
                                <td>
                                    @Html.TextBoxFor(model => model.FullName, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.FullName)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Giới tính</td>
                                <td>
                                    <select id="SelectGender" name="Gender">
                                        <option value="M">Nam</option>
                                        <option value="F">Nữ</option>
                                        <option value="N/A">Khác</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Ngày sinh nhật</td>
                                <td>
                                   @* @Html.TextBoxFor(model => model.DOB, new {@class = "searchInput"})*@
                                    <input class="searchInput" id="DOB" name="DOB" type="text" value="@Model.DOB.ToShortDateString()" />
                                    @Html.ValidationMessageFor(model => model.DOB)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Chatting ID</td>
                                <td>
                                    @Html.TextBoxFor(model => model.ChattingID, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.ChattingID)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Website Cá nhân</td>
                                <td>
                                    @Html.TextBoxFor(model => model.UserURL, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.UserURL)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Điện thoại</td>
                                <td>
                                    @Html.TextBoxFor(model => model.Phone, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.Phone)
                                </td>
                            </tr>
                        </table>
                
                    </div>
                    <div style="clear: both"></div>
                    <div>
                        <input type="submit" class="btn" value="Lưu" style="margin-left: 150px; width: 60px; line-height: 28px; height: 28px; margin-bottom: 10px;" />
                    </div>
                    <br class="spacer"/>
                }
            </div>
        </div>
        <div class="boxMod" id="edit2" >
            <div class="content-header">
                <div class="tweet-user" style="border-bottom: 1px solid #E8E8E8; margin-bottom: 10px;">
                    <h2 style="color: #774F38;">Lựa chọn ảnh đại diện</h2>
                </div>
                <form style="padding: 15px" method="post" enctype="multipart/form-data" action="@Url.Action("Edit","User")" novalidate="novalidate">
                    <div id="file-upload-0" class="file-upload">
                        <div>
                            <input type="file" name="fileUpload" size="40" class="fileupload" accept="image/*" />
                        </div>
                    </div>
                    <br />
                    <input type="submit" style="width: 60px; line-height: 28px; height: 28px;" value="Lưu" class="btn">
                    <br class="spacer" />
                </form>
            </div>
        </div>
        <div class="boxMod" id="edit3" >
            <div class="content-header">
                <form method="POST">
                    <div class="tweet-user" style="border-bottom: 1px solid #E8E8E8; margin-bottom: 10px;">
                        @ViewBag.MessageEmail
                        <h2 style="color: #774F38;">Đổi mật khẩu</h2>
                    </div>
                    <div class="" style="float: left; padding-left: 10px; line-height: 25px">
                        <table id="registertable">
                            <tr>
                                <td style="text-align: right;">Mật khẩu cũ</td>
                                <td>
                                    @Html.PasswordFor(model => model.OldPassword, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.OldPassword)
                            
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Mật khẩu mới</td>
                                <td>
                                    @Html.PasswordFor(model => model.NewPassword, new { @class = "searchInput" })
                                    @Html.ValidationMessageFor(model => model.NewPassword)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Nhập lại mật khẩu mới</td>
                                <td>
                                    @Html.PasswordFor(model => model.ConfirmPassword, new { @class = "searchInput" })
                                    @Html.ValidationMessageFor(model => model.ConfirmPassword)
                                </td>
                            </tr>
                        </table>
                        <div>
                            <input type="submit" class="btn" value="Lưu" style="margin-left: 150px; width: 60px; line-height: 28px; height: 28px; margin-bottom: 10px;" />
                        </div>
                        <br class="spacer"/>
                    </div>
                    <br class="spacer"/>
                </form>
            </div>
        </div>
        
        <div class="boxMod" id="edit4" >
            <div class="content-header">
                <form method="POST">
                    <div class="tweet-user" style="border-bottom: 1px solid #E8E8E8; margin-bottom: 10px;">
                        <h2 style="color: #774F38;">Đổi địa chỉ email</h2>
                    </div>
                    <div class="" style="float: left; padding-left: 10px; line-height: 25px">
                        <table id="registertable">
                            <tr>
                                <td style="text-align: right;">Mật khẩu hiện tại</td>
                                <td>
                                    @Html.PasswordFor(model => model.Password, new { @class = "searchInput" })
                                    @Html.ValidationMessageFor(model => model.Password)
                            
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Email mới</td>
                                <td>
                                    @Html.TextBoxFor(model => model.Email, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.Email)
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">Nhập lại email mới</td>
                                <td>
                                    @Html.TextBoxFor(model => model.ConfirmEmail, new {@class = "searchInput"})
                                    @Html.ValidationMessageFor(model => model.ConfirmEmail)
                                </td>
                            </tr>
                        </table>
                        <div>
                            <input type="submit" class="btn" value="Lưu" style="margin-left: 150px; width: 60px; line-height: 28px; height: 28px; margin-bottom: 10px;" />
                        </div>
                        <br class="spacer"/>
                    </div>
                    <br class="spacer"/>
                </form>
            </div>
        </div>
        
        <div class="boxMod" id="edit5" >
            <div class="content-header">
                <div class="tweet-user" style="border-bottom: 1px solid #E8E8E8; margin-bottom: 10px;">
                    <h2 style="color: #774F38;">Sửa danh sách ưa thích</h2>
                </div>
                <div id="list-fav">
                     
                    @{
                        List<FavoriteList> list = (from s in db.FavoriteLists
                                                   where s.UserID == Model.UserID
                                                   select s).ToList();
                        for (int i = list.Count; i >= 1; i--)
                        {
                            if (i >= 1)
                            {
                                int schoolid = list[i - 1].SchoolID;
                                var school = (from s in db.Schools
                                              where s.SchoolID == schoolid
                                              select s).First();
                                <a href="@Url.Action("Detail", "School", new { schoolID = schoolid })" style="float: left;">@school.SchoolName</a> 
                                <a href="@Url.Action("DeleteFromList","User", new {id = schoolid})" style="float: right">ｘ</a>
                                <br class="spacer"/>
                            }
                                
                                
                        }   
                    }
                </div>
                <br class="spacer"/>
            </div>
        </div>
        
    </div>
    <br class="spacer" />
</div>
